typedef struct {
    int size;
    int *nums;
} MyHashSet;

MyHashSet* myHashSetCreate() {
    MyHashSet *set = malloc(sizeof(MyHashSet));
    set->size = 0;
    return set;
}

void myHashSetAdd(MyHashSet* obj, int key) {

    int *current_nums = obj->nums;
    for (int i=0; i<obj->size; i++){
        if (current_nums[i] == key){
            return;
        }
    }

    obj->size++;
    obj->nums = malloc(obj->size*sizeof(int));
    obj->nums[obj->size-1] =key;

    for (int i=0; i<obj->size-1; i++){
        obj->nums[i] = current_nums[i];
    }
}

void myHashSetRemove(MyHashSet* obj, int key) {
    int *current = obj->nums;

    int find=0;

    for (int i=0; i<obj->size; i++){
        if (current[i] == key){
            find=1;

            for (int j=i; j<obj->size-1; j++){
                obj->nums[j] = obj->nums[j+1];
            }
            break;
        }
    }

    if (find==0){
        return; // no such element
    }

    obj->size--;
    obj->nums = realloc(obj->nums, sizeof(int)*obj->size);


}
bool myHashSetContains(MyHashSet* obj, int key) {
    int *current_nums = obj->nums;
    for (int i=0; i<obj->size; i++){
        if (key == current_nums[i]){
            return true;
        }
    }
    return false;
}

void myHashSetFree(MyHashSet* obj) {
    free(obj->nums);
    free(obj);
}